package com.cskaoyan.service.wx.nj;/*
package com.cskaoyan.service.wx.nj;


import com.cskaoyan.mapper.*;
import com.cskaoyan.mapper.wx.nj.CskaoyanmallOrderGoodsMapper;
import com.cskaoyan.vo.wx.nj.orderwx.HandleOptionBean;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.cskaoyan.mapper.wx.nj.CskaoyanmallOrderMapper;
import com.cskaoyan.bean.wx.nj.CskaoyanmallOrderExample;

import java.util.List;
import com.cskaoyan.bean.wx.nj.CskaoyanmallOrder;

@Service
public class CskaoyanmallOrderServiceImpl implements CskaoyanmallOrderService{

    @Autowired
    CskaoyanmallOrderMapper orderMapper;
    @Autowired
    CartMapper cartMapper;
    @Autowired
    AddressMapper addressMapper;
    @Autowired
    RegionMapper regionMapper;

    @Autowired
    CouponMapper couponMapper;
    @Autowired
    GoodsMapper goodsMapper;
    @Autowired
    CskaoyanmallOrderGoodsMapper orderGoodsMapper;

    @Autowired
    CskaoyanmallCommentMapper commentMapper;
    @Autowired
    CouponUserMapper couponUserMapper;

    @Resource
    private CskaoyanmallOrderMapper cskaoyanmallOrderMapper;

    @Override
    public long countByExample(CskaoyanmallOrderExample example) {
        return cskaoyanmallOrderMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(CskaoyanmallOrderExample example) {
        return cskaoyanmallOrderMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return cskaoyanmallOrderMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(CskaoyanmallOrder record) {
        return cskaoyanmallOrderMapper.insert(record);
    }

    @Override
    public int insertSelective(CskaoyanmallOrder record) {
        return cskaoyanmallOrderMapper.insertSelective(record);
    }

    @Override
    public List<CskaoyanmallOrder> selectByExample(CskaoyanmallOrderExample example) {
        return cskaoyanmallOrderMapper.selectByExample(example);
    }

    @Override
    public CskaoyanmallOrder selectByPrimaryKey(Integer id) {
        return cskaoyanmallOrderMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByExampleSelective(CskaoyanmallOrder record,CskaoyanmallOrderExample example) {
        return cskaoyanmallOrderMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(CskaoyanmallOrder record,CskaoyanmallOrderExample example) {
        return cskaoyanmallOrderMapper.updateByExample(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(CskaoyanmallOrder record) {
        return cskaoyanmallOrderMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(CskaoyanmallOrder record) {
        return cskaoyanmallOrderMapper.updateByPrimaryKey(record);
    }

    @Override
    public OrderwxVO query(Integer showType, Integer page, Integer size, Integer userId) {

        PageHelper.startPage(page,size);
        OrderwxVO orderwxVO = new OrderwxVO();
        Short status = null;
        if (showType == 0){
            status = null;
        }else if (showType == 1){
            status =101;
        }else if (showType == 2){
            status = 20;
        }else if (showType == 3){
            status = 301;
        }else if (showType == 4){
            status = 401;
        }
        List<OrderDataBean> cskaoyanmallOrders = cskaoyanmallOrderMapper.selectAllByUserIdAndOrderStatus(userId, status);
        for (OrderDataBean dataBean : cskaoyanmallOrders) {
            HandleOptionBean handleOption = getHandleOption(dataBean.getOrderStatusText());
            dataBean.setHandleOption(handleOption);
        }

        return new OrderwxVO();
    }

    public HandleOptionBean getHandleOption(String str ){
        if ("未付款".equals(str)){
            HandleOptionBean handleOptionBean = noPay();
            return handleOptionBean;
        }
        if ("用户取消".equals(str)){
            HandleOptionBean handleOptionBean = customCancel();
            return handleOptionBean;
        }
        if ("系统取消".equals(str)){
            HandleOptionBean handleOptionBean = systemCancel();
            return handleOptionBean;
        }
        if ("已付款".equals(str)){
            HandleOptionBean handleOptionBean = payed();
            return handleOptionBean;
        }
        if ("申请退款".equals(str)){
            HandleOptionBean handleOptionBean = applyRefund();
            return handleOptionBean;
        }
        if ("已退款".equals(str)){
            HandleOptionBean handleOptionBean = refund();
            return handleOptionBean;
        }
        if ("已发货".equals(str)){
            HandleOptionBean handleOptionBean = sendGoods();
            return handleOptionBean;
        }

        if ("用户收货".equals(str)){
            HandleOptionBean handleOptionBean = customGetGoods();
            return handleOptionBean;
        }
        if ("系统收货".equals(str)){
            HandleOptionBean handleOptionBean = systemGetGoods();
            return handleOptionBean;
        }
        return null;
    }


    //未付款
    public HandleOptionBean noPay(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(true);
        handleOptionBean.setPay(true);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(false);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }

    //用户取消
    public HandleOptionBean customCancel(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(true);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }
    //系统取消
    public HandleOptionBean systemCancel(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(true);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }

    //已付款
    public HandleOptionBean payed(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(true);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(false);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }
    //申请退款
    public HandleOptionBean applyRefund(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(true);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(false);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }
    //已经退款
    public HandleOptionBean refund(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(true);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }
    //发货
    public HandleOptionBean sendGoods(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(true);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(false);
        handleOptionBean.setDelete(false);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }
    //用户收货
    public HandleOptionBean customGetGoods(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(true);
        handleOptionBean.setDelete(true);
        handleOptionBean.setComment(true);
        return handleOptionBean;
    }
    //系统收货
    public HandleOptionBean systemGetGoods(){
        HandleOptionBean handleOptionBean = new HandleOptionBean();
        handleOptionBean.setCancel(false);
        handleOptionBean.setPay(false);
        handleOptionBean.setConfirm(false);
        handleOptionBean.setRefund(false);
        handleOptionBean.setRebuy(true);
        handleOptionBean.setDelete(true);
        handleOptionBean.setComment(false);
        return handleOptionBean;
    }
}
*/
